package zada.wzorzec;

import java.awt.Dimension;
import javax.swing.*;

/**
 *
 * @author Jakub Banaszewski
 */
public class Main extends JFrame
{
   
   private JTextField textField;
   private JButton button;
   private JTextPane textPane;
   
   Main()
   {
      super("Wyszukiwanie wzorca");
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
   }
   
   public void initGui()
   {
      textField = new JTextField("Wzorzec");
      button = new JButton("Szukaj");
      textPane = new JTextPane();
      textPane.setSize(400, 400);
      this.setPreferredSize(new Dimension(400, 450));
      GroupLayout layout = new GroupLayout(getContentPane());
      setLayout(layout);
      
      GroupLayout.ParallelGroup hor = layout.createParallelGroup(GroupLayout.Alignment.LEADING, true);
      GroupLayout.SequentialGroup h1 = layout.createSequentialGroup();
      h1.addComponent(textField);
      h1.addComponent(button);
      hor.addGroup(h1);
      hor.addComponent(textPane);
      
      layout.setHorizontalGroup(hor);
      
      GroupLayout.SequentialGroup vert = layout.createSequentialGroup();
      GroupLayout.ParallelGroup v1 = layout.createParallelGroup(GroupLayout.Alignment.LEADING, false);
      v1.addComponent(textField);
      v1.addComponent(button);
      vert.addGroup(v1);
      vert.addGap(10);
      vert.addComponent(textPane);
      
      layout.setVerticalGroup(vert);
      
      pack();
      
   }
   
   
   public static void main(String[] args)
   {
      Main main = new Main();
      main.initGui();
      main.setVisible(true);
   }
}
